﻿@using eLoan.Models;
@model GenerateScheduleModel
@{
    ViewBag.Title = "Payment Schedule";
    var documentNo = ViewBag.DocumentNo;
    var command = ViewBag.Command;

    var showCreateSchedule = command == "CreateSchedule" ? "display:inline" : "display:none";
    var showDeleteSchedule = command == "DeleteSchedule" ? "display:inline" : "display:none";
    
}

<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-lg-10">
        <h2>
            <span style="@showCreateSchedule">Generate Payment Schedule</span>
            <span style="@showDeleteSchedule">Delete Payment Schedule</span>
        </h2>
        
        <ol class="breadcrumb">
            <li>
                Funding
            </li>
            <li>
                <a href="@Url.Action("Loans", "Funding")">Loans</a>
            </li>
            <li>
                <a href="@Url.Action("LoanDetails", "Loan", new { documentNo = documentNo })">Loan Details</a>
            </li>
            <li class="active">
                <strong style="@showCreateSchedule">Generate Payment Schedule</strong>
                <strong style="@showDeleteSchedule">Delete Payment Schedule</strong>
            </li>
        </ol>
    </div>
    <div class="col-lg-2"></div>
</div>

<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-8">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <span style="@showCreateSchedule">Generate payment schedule for loan <strong>@ViewBag.DocumentNo</strong></span>
                    <span style="@showDeleteSchedule">Delete payment schedule for loan <strong>@ViewBag.DocumentNo</strong></span>
                </div>
                <div class="ibox-content">

                    @using (Html.BeginForm("CreatePaymentSchedule", "LoanSchedule", new { documentNo = @ViewBag.DocumentNo }, FormMethod.Post, new { id = "createdeleteForm" }))
                    {
                        @Html.HiddenFor(m => Model.PaymentStartDate)
                        @Html.HiddenFor(m => Model.PaymentEndDate)
                        @Html.HiddenFor(m => Model.Term)
                        <fieldset>
                            <button type="submit" id="btnCreate" class="btn btn-primary" name="command" value="CreateSchedule" style="@showCreateSchedule">Generate payment schedule</button>
                            <button type="submit" id="btnDelete" class="btn btn-primary" name="command" value="DeleteSchedule" style="@showDeleteSchedule">Delete payment schedule</button>
                            <button type="submit" id="btnCancel" class="btn btn-primary" name="command" value="Cancel">Cancel</button>
                        </fieldset>
                    }

                </div>
            </div>

        </div>
    </div>
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}